﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Auth.Interfaces;
using Auth.DTOs;
using SCMS.Model;

namespace Auth.Implementations.Users
{
    public class UserManagementService : IUserManagementService
    {
        public List<SystemUserDetail> GetAllStaff()
        {
            List<SystemUserDetail> sysUsers = new List<SystemUserDetail>();

            var dbContext = new SCMSEntities();
            IEnumerable<SCMS.Model.Staff> staff = dbContext.Staffs.Where(s => s.Id != null);

            foreach (SCMS.Model.Staff s in staff)
            {
                SystemUserDetail su = new SystemUserDetail();

                su.StaffId = s.Id;
                su.FirstName = s.Person.FirstName;
                su.OtherNames = s.Person.OtherNames;
                su.CountryOffice = s.CountrySubOffice.Location.Name;
                sysUsers.Add(su);
            }


            return sysUsers;
        }
    }
}
